/*
 * @Date: 2020-08-26 14:47:52
 * @LastEditors: xujianxing
 * @LastEditTime: 2020-08-26 14:53:09
 * @FilePath: \nili\src\common\interceptor\cache.interceptor.ts
 *
 * 缓存拦截器 拦截住请求 使用缓存
 */

import {
  Injectable,
  NestInterceptor,
  ExecutionContext,
  CallHandler,
} from '@nestjs/common';
import { of, Observable } from 'rxjs';

@Injectable()
export class cacheInterceptor implements NestInterceptor {
  intercept(ctx: ExecutionContext, next: CallHandler): Observable<any> {
    const isCache = true;
    if (isCache) {
      return of([]);
    }
    // 不会继续往下走，也就不会经过路由
    return next.handle();
  }
}
